<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #map {
            width: 800px;
            height: 600px;
            background-color: #ccc;
            margin: 0 auto 50px;
            /* 蛇和食物的定位需要依赖地图进行定位 */
            position: relative;
        }
        
        .btn {
            width: 70px;
            height: 30px;
            margin: 40px auto 0;
        }
    </style>
    <script src="js/food.js"></script>
    <script src="js/snake.js"></script>
    <script src="js/game.js"></script>
</head>

<body>
    <div class="btn">
        <button class="start">开始游戏</button>
    </div>
    <div id="map">
    </div>
    <script>
        //获取地图元素
        var map = document.querySelector('#map');
        var start = document.querySelector('.start');
        var game = new Game(map);
        game.render();
        start.addEventListener('click', function() {
            game.startGame();
        });
        // console.log(game);
    </script>
</body>

</html>